import React,{Component,useMemo} from 'react'

const Show = ({count})=>{
    const count2 = useMemo(()=>{
        console.log('执行逻辑')
        return count
    },[count])
    
    return (
        <div>{count2}</div>
    )
}

export default class Count extends Component {

    constructor(props){
        super(props)
        this.state = {
            count:0,
            noRely :'noRely'
        }
    }

    onClick = ()=>{
        this.setState({
            count:this.state.count + 1
        })
    }

    render(){
        let {count,noRely} = this.state
        return (
            <div>
                <button onClick={ ()=> this.onClick() }>++</button>
                <Show count={count}></Show>
            </div>
        )
    }
}

